package ink.lovejinhu.leetcode;

import ink.lovejinhu.common.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jinhu
 * created 2021-07-01 9:26
 */
public class Solution_0145 {
    /**
     * 左右根
     * 后续遍历
     */
    public List<Integer> preList = new ArrayList<>();

    public List<Integer> postorderTraversal(TreeNode root) {
        if (root == null) {
            return null;
        }
        postorderTraversal(root.left);
        postorderTraversal(root.right);

        System.out.println(root.val);
        preList.add(root.val);
        return preList;
    }
}
